package day240519_report.e3;

public class Person {
    private String name;
    private int age;

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        if (age >= 0 && age <= 120) {
            this.age = age;
        } else {
            System.out.println("年龄范围应该在0到120之间");
        }
    }

    public void adept(Animal animal) {
        System.out.println(this.name + "养了只" + animal.age + "岁的" + animal.name);
    }

}
